package com.caleble.sample.dao.ibatis;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.caleble.sample.domain.Message;
import com.caleble.sample.domain.MessageExample;
import com.ibatis.sqlmap.client.SqlMapClient;

@Component
@Scope("prototype")
@Transactional
public class MessageDAOImpl extends SqlMapClientDaoSupport implements MessageDAO {

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public MessageDAOImpl() {
		super();
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public void insert(Message record) {
		getSqlMapClientTemplate().insert("CALEBLE_MESSAGE.abatorgenerated_insert", record);
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public int updateByPrimaryKey(Message record) {
		int rows = getSqlMapClientTemplate().update("CALEBLE_MESSAGE.abatorgenerated_updateByPrimaryKeyWithBLOBs", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public int updateByPrimaryKeySelective(Message record) {
		int rows = getSqlMapClientTemplate().update("CALEBLE_MESSAGE.abatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	@SuppressWarnings("unchecked")
	public List<Message> selectByExampleWithoutBLOBs(MessageExample example) {
		List<Message> list = (List<Message>) getSqlMapClientTemplate().queryForList("CALEBLE_MESSAGE.abatorgenerated_selectByExample", example);
		return list;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	@SuppressWarnings("unchecked")
	public List<Message> selectByExampleWithBLOBs(MessageExample example) {
		List<Message> list = (List<Message>) getSqlMapClientTemplate().queryForList("CALEBLE_MESSAGE.abatorgenerated_selectByExampleWithBLOBs", example);
		return list;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public Message selectByPrimaryKey(String msgid) {
		Message key = new Message();
		key.setMsgid(msgid);
		Message record = (Message) getSqlMapClientTemplate().queryForObject("CALEBLE_MESSAGE.abatorgenerated_selectByPrimaryKey", key);
		return record;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public int deleteByExample(MessageExample example) {
		int rows = getSqlMapClientTemplate().delete("CALEBLE_MESSAGE.abatorgenerated_deleteByExample", example);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public int deleteByPrimaryKey(String msgid) {
		Message key = new Message();
		key.setMsgid(msgid);
		int rows = getSqlMapClientTemplate().delete("CALEBLE_MESSAGE.abatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public int countByExample(MessageExample example) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("CALEBLE_MESSAGE.abatorgenerated_countByExample", example);
		return count;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public int updateByExampleSelective(Message record, MessageExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update("CALEBLE_MESSAGE.abatorgenerated_updateByExampleSelective", parms);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public int updateByExampleWithBLOBs(Message record, MessageExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update("CALEBLE_MESSAGE.abatorgenerated_updateByExampleWithBLOBs", parms);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds
	 * to the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	public int updateByExampleWithoutBLOBs(Message record, MessageExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update("CALEBLE_MESSAGE.abatorgenerated_updateByExample", parms);
		return rows;
	}

	/**
	 * This class was generated by Abator for iBATIS. This class corresponds to
	 * the database table CALEBLE.MESSAGE
	 * 
	 * @abatorgenerated Mon Dec 08 18:56:00 CST 2008
	 */
	private static class UpdateByExampleParms extends MessageExample {
		private Object record;

		public UpdateByExampleParms(Object record, MessageExample example) {
			super(example);
			this.record = record;
		}

		public Object getRecord() {
			return record;
		}
	}

	@Autowired
	public void setSuperSqlMapClient(SqlMapClient sqlMapClient) {
		super.setSqlMapClient(sqlMapClient);
	}
}